import settings from 'electron-settings';
import fse from 'fs-extra';
import path from 'path';
import os from 'os';

import fs from 'fs';

//检验是否存在某个目录
fs.readdir('D:\\sqliteExe', (err, data) => {
    if (err) {
        //文件加创建成功
        createCatalog().then((res)=>{
        });
        return;
    }
    //存在目录

})

export const docDir = path.join('D:\\sqliteExe', 'my-project');
/*const settingsPath = path.join(docDir, 'settings.json');
fse.ensureFileSync(settingsPath);
settings.setPath(settingsPath);*/

function createCatalog() {
    return new Promise((reslove,reject)=>{
        fs.mkdir('D:\\sqliteExe', (err) => {
            if (err) {
                reject();
                return;
            }
            reslove();
        })
    })
}


//先创建data目录 目录文件操作存在权限问题



export default settings;
